<?php
	session_start();
	$CI = &get_instance();
	$session=session_id();
	$time=time();
	$time_check=$time-200; //SET TIME 10 Minute
	$count=$CI->model->count_session_online($session);
	
	$CI->load->model('model_cp','model');
	
	if($count=="0"){
		$CI->model->insert_songuoionline($session, $time);
	}
	else {
		$CI->model->update_nguoionline($time, $session);
	}
	$count_user_online=$CI->model->get_count_truycap();
	//echo "<span class='text'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Đang online:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $count_user_online ";
	$CI->model->delete_truycap($time_check);
?>
<div class="wrapper left-box-wrapper">
    <div class="left-box-title"><h2>Thống kê</h2></div>
    <div class="left-box-content">
        <ul id="ul-counter">
            <li><a href="#"><img src="images/icon-counter1.png" />Số người online : <font class="b-blue"><?=$count_user_online?></font></a></li>
            <li><a href="#"><img src="images/icon-counter3.png" />Lượt truy cập thứ: <font class="b-blue"><?=$soluottruycap->id?></font></a></li>
         </ul>
    
    </div>
    <div class="left-box-shadow"></div>
</div>